package com.cx.purchase.util;

public class PageVo {
	private Integer pageIndex;//��ǰҳ
	private Integer pageSize;//ÿҳ��С
	private Integer offset;//������
	
	
	
	public Integer getPageIndex() {
		return pageIndex;
	}
	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
		initParamter();
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	
	public Integer getOffset() {
		return offset;
	}
	public void setOffset(Integer offset) {
		this.offset = offset;
	}
	
	 /**
     * ����ǰ�˴�ֵ�������ҳ����
     */
    private void initParamter(){
    	if(pageIndex==null){
    		pageIndex = 1;//Ĭ�ϵ�һҳ
    	}
        if(pageIndex<1){
        	pageIndex = 1;//Ĭ�ϵ�һҳ
        }
        if(this.pageSize==null){
        	 this.pageSize = 10;
        }
        if (this.pageSize == 0) {
            this.pageSize = 10;//Ĭ��ÿҳ��ʾ10��
        }

        final int startIndex = (this.pageIndex - 1) * this.pageSize;
        setOffset(startIndex);
    }
    
    

}
